import pytest
import requests

class Test():

    uid=""
    sid=""
    mid=""
    cid=""
    oid=""
    def setup_method(self):
        pass

    def teardown_method(self):
        pass

    # 登录
    def test_login(self):
        url="http://10.59.9.18/movieApi/user/v2/login"
        data={"email":"1478997572@qq.com","pwd":"eWLPHopE945d2ivttHaQTQ=="}
        r=requests.post(url=url,params=data)
        print(r.json())
        Test.uid=r.json()['result']['userId']
        Test.sid=r.json()['result']['sessionId']
    # 查询正在上映电影列表
    def test_f(self):
        url="http://10.59.9.18/movieApi/movie/v2/findReleaseMovieList"
        data={"page":"1","count":"10"}
        r=requests.get(url=url, data=data)
        print("电影列表",r.json())
        assert "碟中谍6" in r.json()['result'][0]['name']
        Test.mid=r.json()['result'][0]['movieId']
    # 查询附近影院
    def test_find(self):
        url="http://10.59.9.18/movieApi/cinema/v1/findNearbyCinemas"
        data = {"longitude": "115", "latitude": "34", "page": "1", "count": "10"}
        r=requests.get(url=url,params=data)
        Test.cid=r.json()['result'][0]['id']
        print("附近电影影院列表",r.json())



